package fixtures;

import fit.ActionFixture;
import server.DB;
import server.ServerWindow;
import Entity.Deal;

public class InitiateSaleOperation extends ActionFixture {
	DB db=null;
	Deal deal=null;
	boolean testResult;
	String ResaulStr=null;
	String[] arr;
	ServerWindow sv;
	
	public void startInsert()
	{
		deal=new Deal();
	}
	
	public void enterDealID(String DId)
	{
		deal.setDealID(DId);
	}
	 
	public void enterStartDate (String sDate)
	{
		deal.setStartDate(sDate);
	}
	public void enterEndDate (String eDate)
	{
		deal.setEndDate(eDate);
	}
	
	public void enterTemplateID (String TID)
	{
		deal.setTemplateID(TID);
	}
	
	public void enterDeaDiscount (String Ddisc)
	{
		deal.setDeaDiscount(Ddisc);
	}
	
	public void setup(){
		sv.arr[4]="localhost";
		sv.arr[1]="root";
		sv.arr[2]="Braude";
		String[] arr = new String[10];
		arr[1]="dealdb";
		arr[2]=deal.getDealID();
		arr[3]=deal.getStartDate();
		arr[4]=deal.getEndDate();
		arr[5]=deal.getTemplateID();
		arr[6]=deal.getDeaDiscount();
		db=new DB(arr);
		
		ResaulStr=(String) db.DealAddToDB(arr);
		if(ResaulStr.equals("Deal Added To System DataBase !"))
			testResult=true;
		else
			testResult=false;	
	}
	
	public boolean Initiate_new_deal()
	{	
		return testResult;
	}
	
	
}